Skip to content

v0.9.1: Cellpose and Register comfort fixes, Stop button (#574, #579, #580) - #582

Draft
guijacquemet wants to merge 14 commits into
mainfrom
claude/v0.9.1
Draft

guijacquemet wants to merge 14 commits into
mainfrom
claude/v0.9.1

Conversation

@guijacquemet

Copy link
Copy Markdown
Contributor

Draft, work in progress: the v0.9.1 integration branch. Do not merge. The full description, tests and gate results will be filled in as items land.

Merged so far: #577 (ae64ecc) and the cpdino fix.


Generated by Claude Code

…h run

The owner's Colab test of v0.9.0 (26 November 2026): some nuclei results of
the first Preview stayed on screen after later Previews. The result (card and
figures) was displayed into the step's output area and its clearing was left
to the frontend; a Preview that failed (Cellpose, or the model's load) also
kept the earlier result in `previewed`, and the Segment step's line still
compared with it.

The result now lives in one box of widgets (`CellposeWorkflow.preview_box`,
the figures as PNG pictures), emptied (and its widgets closed) when Preview is
pressed, before the model is loaded; when the channels or the output change;
and when a Preview fails. While Cellpose runs, the box says "Running <model>
on the preview image...". A Preview still writes and records nothing.

Regression tests: tests/test_notebook_cellpose_preview_stale.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
… torch warning (#574)

Item 3 (owner decision, 26 November 2026): choosing the model and pressing
Preview or Segment (or Load the model) is the consent to download its
weights. The weights-download and DINOv3 ticks are removed from the model
form. The brick downloads only the chosen model's file from the Hugging
Face repository at a pinned commit, keeps it only with its pinned size and
SHA-256 (a cached copy is checked too), and hands Cellpose the absolute
path. A failed or blocked download is a refusal naming the model and the
URL; no other model is used. The notebook shows a "Downloading <model>
weights..." line with progress. DINOv3 is installed at its pinned commit
on a DINOv3 model's first load when none is installed; another commit is
refused, not replaced. The record adds weights_repository,
weights_revision, dinov3_source and dinov3_installed.

Item 5: evaluate runs model.eval inside sparse_warning_hidden(), which
filters only torch's "Sparse invariant checks are implicitly disabled"
UserWarning from the torch or cellpose modules, in catch_warnings.

normalization, eval_arguments and inference_parameters move to
segmentation_cellpose_eval (re-exported) for the 600-line rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
…items 6-7)

Item 6: the tick box "Declare <type> as separate objects" under a TOML
preview is replaced by a question per mask type with no answer chosen:
"Each object has its own number (label image: every cell/nucleus is a
separate object)" or "Foreground / background only (binary mask)", with
one sentence on why we ask. The TOML is shown only folded (<details>).
The recorded value (representation = "instances") and the refusal while
a mask type is unanswered are unchanged; a binary answer is refused beside
the button (Cellpose gives each object its own number), nothing records it.

Item 7: Register showed nothing in cell 5 while it read, per image of a
verify_content run, 4 whole files (SHA-256: cell 5's checks, the app's
run, its pre-publish check, the tissue-mask step's opening) and per mask
5 (run, pre-publish check, mask step fingerprints before/after, pixels).
Each read is a check or the data itself, so none is removed; reads per
file and the normalized run-folder digests are identical to main.
RegisterWait (notebook_progress.Wait and its ticking thread, #567) shows
"Step k of 5 · <step>" with the elapsed time and the step's own line:
the run's checks counted through open_run(checking=) (open_checks and
run_inputs.open_checked, identical to #575's hunks), and the app's own
wait lines copied while each step runs. Notebook cells are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
… change

Review of #576: the channel dropdowns are live (Preview and Segment re-read
them with current_targets()), but changing them after a Preview left the
result on screen and in `previewed`; with a Both preview shown, removing the
nuclear channel kept "Nuclei" on screen. The same was true of the model
step's fields, which Preview and Segment also read when pressed.

The preview is now also cleared when a channel dropdown, a channel number or
By tag/number changes (ChannelPicker.on_edit; Segment's line then says "not
previewed yet"), when a field of the model step changes (Segment's line still
names what changed since the last Preview), and in the cell-by-cell
workflow when the settings change, a model is loaded or the nuclei go back
to the cells' model.

The style sheet is shown once even when the first Preview fails (it was
keyed on a card having been shown). figure_image's docstring: one period.

Regression tests: tests/test_notebook_cellpose_preview_stale.py (5 new).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
open_run now opens through run_inputs.open_checked (the hunks shared with
#575), so the test that publishes the run while it is opened patches that
function instead of RunInputs.open. Same change, byte for byte, as #575's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
…rors (review of #577)

- The weights file's identity (device, inode, size, mtime_ns) taken when it
  is hashed must be unchanged right before Cellpose opens it and after it
  loaded it (also for a model file of one's own), else the load is refused:
  a file gone in between would make Cellpose fetch a model from its moving
  branch with TLS off while the record carried the pinned hash.
- A local write error (a full disk) is a write refusal naming the folder,
  not a network one; a failed rename is a SegmentationError naming the
  target; the download is fsynced before the rename.
- Tests: the identity checks (removed, replaced, gone before the load, own
  file), the sparse filter put back when Cellpose raises, the full disk,
  the failed rename and fsync before rename.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
… on the next press

When the folder check that Register the masks makes with the masks folder
failed (an OSError such as Drive not answering, or a coded refusal), cell 5
said to confirm the axes again in cell 3, the reason was drawn only in cell 3,
and every later press (and cell 5 run again) raised AttributeError out of the
click handler because app.preflight was None. Cell 5 now shows CHECK_FAILED
with cell 3's reason and continues once cell 3's check is made again; an
unexpected error during a press is shown in cell 5 (STOPPED) and re-raised.
Nothing checked, declared or written changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
Cellpose weights downloaded on first use, pinned and checked; the torch sparse warning
hidden (#574 items 3 and 5). CHANGELOG conflict resolved by keeping both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VbytvF3Gsa85ix8Ne2yMDW
…t helps

The combined notebook's Install Cellpose step installs the pinned DINOv3 code
(--no-deps, no weights) before Cellpose when none is installed, so a cpdino
model loaded after a cpsam one needs no runtime restart. ensure_dinov3 clears
the import caches after installing. check_dinov3 asks for a restart only when
DINOv3 imports now but Cellpose missed it; a DINOv3 that does not import is
refused with its import error. Tests for each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VbytvF3Gsa85ix8Ne2yMDW
Cell 5 asks what each mask is; Register shows each step as it goes (#574 items 6-7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VbytvF3Gsa85ix8Ne2yMDW
Fixes #580 on top of #578's Register wait: a failed re-check stops with
CHECK_FAILED and cell 3's reason; later presses and cell 5 run again refuse
without AttributeError; an unexpected error is shown in cell 5 (STOPPED) and
re-raised, with the wait's "Stopped after" line. Conflicts resolved so both
fixes hold; the tests of #581 use #578's question (choices, not ticks).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VbytvF3Gsa85ix8Ne2yMDW
- Binary answer for a Cellpose mask: coded refusal (cellpose_mask_not_binary)
  saying why (Cellpose numbers each object); binary masks from elsewhere stay
  declarable in cell 3.
- Within one press, a content SHA-256 is reused while the file identity
  (st_dev, st_ino, st_size, st_mtime_ns, st_ctime_ns) is unchanged
  (content_memo.ContentMemo, created per press, passed explicitly; never at
  publication). Images: 2 whole reads per press instead of 4 (+1 for the
  former first press). A rewrite the identity cannot see is still refused by
  the run's check before it publishes (tested).
- Cell 5 is displayed first (shared notebook_shown_first.ShownFirst with
  cell 4), then opens the run with its n-of-N wait; cell text unchanged.
- One press: when the folders and image headers are unchanged since cell 3's
  check (register_checks.changes_since_check), the masks are paired with the
  app's Check the masks again and the confirmed axes are kept; otherwise the
  folder check is made again and the axes stop says what changed.
- Refusal helpers moved to register_checks (600-line rule); install tests
  moved to their own file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VbytvF3Gsa85ix8Ne2yMDW
#579)

Owner decision on #579: typing or pasting a folder path never starts a scan,
a check or a restore. Editing a box only clears what came from the old
folders and says which button to press (Scan the folders / Check folder);
the restore of earlier work (#547/#566) runs on that press. The folder check
and the quick scan run inside Wait.ticking(), stale results are hidden before
each check and cleared when the folders change, and the comparison phase
reports its parts as n of N (preflight.ACQUISITION_PARTS).

Also, in the same area:
- #517: a new run attempt, or another output folder, clears the result the
  Run step showed (no "done" chip for another folder or a failed attempt).
- #519: the earlier run's inputs are resolved again for another experiment
  root with the same output folder; its confirmations are never inherited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VbytvF3Gsa85ix8Ne2yMDW
…l-running line (#574 item 4)

#576 shipped in the v0.9.0 tag through the release branch but was never
merged into main, so v0.9.1 would have lost it. Merged here; conflicts with
#577's load signature resolved (clear_preview kept, no download ticks).

#574 item 4 on top: while the model segments the preview image the line
says "Running <model> on <image>…" for each model in turn, with a ticking
time (notebook_progress.Wait), and the batch's progress line names the model
("Running <model> · n of N · <image>"). Tests in test_notebook_cellpose_preview
and test_notebook_cellpose_preview_stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VbytvF3Gsa85ix8Ne2yMDW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants